@@ -306,7 +306,7 @@ class UserInfo(BaseModelMixin, LensmanTypeBoolMixin): |
||
| 306 | 306 |
'subscribe': self.subscribe, |
| 307 | 307 |
'membercardid': self.membercardid, |
| 308 | 308 |
'memberusercardcode': self.memberusercardcode, |
| 309 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 309 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 310 | 310 |
'code_version': self.code_version, |
| 311 | 311 |
|
| 312 | 312 |
# 商品信息 |
@@ -20,7 +20,7 @@ from account.models import UserInfo |
||
| 20 | 20 |
from api.encrypt_views import get_ciphertext |
| 21 | 21 |
from coupon.models import CouponInfo, UserCouponInfo |
| 22 | 22 |
from integral.models import SaleclerkSubmitLogInfo |
| 23 |
-from logs.models import ComplementCodeLogInfo, MchInfoEncryptLogInfo, AdministratorLoginLogInfo |
|
| 23 |
+from logs.models import AdministratorLoginLogInfo, ComplementCodeLogInfo, MchInfoEncryptLogInfo |
|
| 24 | 24 |
from mch.models import AdministratorInfo, BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, ModelInfo |
| 25 | 25 |
from member.models import (GoodsInfo, GoodsOrderInfo, MemberActivityGroupShareInfo, MemberActivityInfo, |
| 26 | 26 |
MemberActivitySignupInfo) |
@@ -974,6 +974,7 @@ def member_activity_list(request): |
||
| 974 | 974 |
count = logs.count() |
| 975 | 975 |
logs, left = pagination(logs, page, num) |
| 976 | 976 |
logs = [log.admindata for log in logs] |
| 977 |
+ |
|
| 977 | 978 |
return response(200, 'Get Member Activity Record Success', u'获取会员活动成功', data={
|
| 978 | 979 |
'logs': logs, |
| 979 | 980 |
'left': left, |
@@ -1009,19 +1010,25 @@ def member_activity_update(request): |
||
| 1009 | 1010 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1010 | 1011 |
admin_id = request.POST.get('admin_id', '')
|
| 1011 | 1012 |
activity_id = request.POST.get('activity_id', '')
|
| 1013 |
+ activity_type = int(request.POST.get('activity_type', 0))
|
|
| 1012 | 1014 |
title = request.POST.get('title', '')
|
| 1013 | 1015 |
subtitle = request.POST.get('subtitle', '')
|
| 1014 | 1016 |
date = request.POST.get('date', '')
|
| 1017 |
+ start_date = request.POST.get('start_date', '')
|
|
| 1018 |
+ end_date = request.POST.get('end_date', '')
|
|
| 1019 |
+ start_display_date = request.POST.get('start_display_date', '')
|
|
| 1020 |
+ end_display_date = request.POST.get('end_display_date', '')
|
|
| 1015 | 1021 |
city = request.POST.get('city', '')
|
| 1016 | 1022 |
location = request.POST.get('location', '')
|
| 1017 | 1023 |
integral = int(request.POST.get('integral', 0))
|
| 1018 |
- cover_url = request.POST.get('cover_path', '')
|
|
| 1019 |
- slider_image = request.POST.get('banner_path', '')
|
|
| 1020 |
- image = request.POST.get('banner_path', '')
|
|
| 1024 |
+ is_slider = request.POST.get('is_slider', '')
|
|
| 1025 |
+ slider_image_path = request.POST.get('banner_path', '')
|
|
| 1026 |
+ cover_path = request.POST.get('cover_path', '')
|
|
| 1027 |
+ # image_path = request.POST.get('image_path', '') or request.POST.get('banner_path', '')
|
|
| 1028 |
+ limit_image_num = int(request.POST.get('limit_image_num', 3))
|
|
| 1021 | 1029 |
is_signup = request.POST.get('is_signup', '')
|
| 1022 | 1030 |
group_share_max_integral = int(request.POST.get('share_max_integral', 0))
|
| 1023 | 1031 |
group_share_integral = int(request.POST.get('share_integral', 0))
|
| 1024 |
- is_slider = request.POST.get('is_slider', '')
|
|
| 1025 | 1032 |
content_rich_text = request.POST.get('content_rich_text', '')
|
| 1026 | 1033 |
share_h5_link = request.POST.get('share_h5_link', '')
|
| 1027 | 1034 |
activity_state = int(request.POST.get('activity_state', 0))
|
@@ -1039,19 +1046,25 @@ def member_activity_update(request): |
||
| 1039 | 1046 |
except MemberActivityInfo.DoesNotExist: |
| 1040 | 1047 |
return response() |
| 1041 | 1048 |
|
| 1049 |
+ log.activity_type = activity_type |
|
| 1042 | 1050 |
log.title = title |
| 1043 | 1051 |
log.subtitle = subtitle |
| 1044 |
- log.date = datetime.strptime(date + ' 23:59:59', '%Y-%m-%d %H:%M:%S') |
|
| 1052 |
+ log.date = date |
|
| 1053 |
+ log.start_date = start_date |
|
| 1054 |
+ log.end_date = end_date |
|
| 1055 |
+ log.start_display_date = start_display_date |
|
| 1056 |
+ log.end_display_date = end_display_date |
|
| 1045 | 1057 |
log.city = city |
| 1046 | 1058 |
log.location = location |
| 1047 | 1059 |
log.integral = integral |
| 1048 |
- log.cover = cover_url |
|
| 1049 |
- log.slider_image = slider_image |
|
| 1050 |
- log.image = slider_image |
|
| 1060 |
+ log.is_slider = is_slider |
|
| 1061 |
+ log.slider_image = slider_image_path |
|
| 1062 |
+ log.cover = cover_path |
|
| 1063 |
+ # log.image = image_path |
|
| 1064 |
+ log.limit_image_num = limit_image_num |
|
| 1051 | 1065 |
log.is_signup = is_signup |
| 1052 | 1066 |
log.group_share_integral = group_share_integral |
| 1053 | 1067 |
log.group_share_max_integral = group_share_max_integral |
| 1054 |
- log.is_slider = is_slider |
|
| 1055 | 1068 |
log.content_rich_text = content_rich_text |
| 1056 | 1069 |
log.share_h5_link = share_h5_link |
| 1057 | 1070 |
log.activity_state = activity_state |
@@ -1063,19 +1076,25 @@ def member_activity_update(request): |
||
| 1063 | 1076 |
def member_activity_create(request): |
| 1064 | 1077 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1065 | 1078 |
admin_id = request.POST.get('admin_id', '')
|
| 1079 |
+ activity_type = int(request.POST.get('activity_type', 0))
|
|
| 1066 | 1080 |
title = request.POST.get('title', '')
|
| 1067 | 1081 |
subtitle = request.POST.get('subtitle', '')
|
| 1068 | 1082 |
date = request.POST.get('date', '')
|
| 1083 |
+ start_date = request.POST.get('start_date', '')
|
|
| 1084 |
+ end_date = request.POST.get('end_date', '')
|
|
| 1085 |
+ start_display_date = request.POST.get('start_display_date', '')
|
|
| 1086 |
+ end_display_date = request.POST.get('end_display_date', '')
|
|
| 1069 | 1087 |
city = request.POST.get('city', '')
|
| 1070 | 1088 |
location = request.POST.get('location', '')
|
| 1071 | 1089 |
integral = int(request.POST.get('integral', 0))
|
| 1072 |
- cover_url = request.POST.get('cover_path', '')
|
|
| 1073 |
- slider_image = request.POST.get('banner_path', '')
|
|
| 1074 |
- image = request.POST.get('banner_path', '')
|
|
| 1090 |
+ is_slider = request.POST.get('is_slider', '')
|
|
| 1091 |
+ slider_image_path = request.POST.get('banner_path', '')
|
|
| 1092 |
+ cover_path = request.POST.get('cover_path', '')
|
|
| 1093 |
+ # image_path = request.POST.get('image_path', '') or request.POST.get('banner_path', '')
|
|
| 1094 |
+ limit_image_num = int(request.POST.get('limit_image_num', 3))
|
|
| 1075 | 1095 |
is_signup = request.POST.get('is_signup', '')
|
| 1076 | 1096 |
group_share_max_integral = int(request.POST.get('share_max_integral', 0))
|
| 1077 | 1097 |
group_share_integral = int(request.POST.get('share_integral', 0))
|
| 1078 |
- is_slider = request.POST.get('is_slider', '')
|
|
| 1079 | 1098 |
content_rich_text = request.POST.get('content_rich_text', '')
|
| 1080 | 1099 |
share_h5_link = request.POST.get('share_h5_link', '')
|
| 1081 | 1100 |
activity_state = int(request.POST.get('activity_state', 0))
|
@@ -1090,19 +1109,25 @@ def member_activity_create(request): |
||
| 1090 | 1109 |
|
| 1091 | 1110 |
MemberActivityInfo.objects.create( |
| 1092 | 1111 |
brand_id=administrator.brand_id, |
| 1112 |
+ activity_type=activity_type, |
|
| 1093 | 1113 |
title=title, |
| 1094 | 1114 |
subtitle=subtitle, |
| 1095 | 1115 |
date=date, |
| 1116 |
+ start_date=start_date, |
|
| 1117 |
+ end_date=end_date, |
|
| 1118 |
+ start_display_date=start_display_date, |
|
| 1119 |
+ end_display_date=end_display_date, |
|
| 1096 | 1120 |
city=city, |
| 1097 | 1121 |
location=location, |
| 1098 | 1122 |
integral=integral, |
| 1099 |
- cover=cover_url, |
|
| 1100 |
- slider_image=slider_image, |
|
| 1101 |
- image=image, |
|
| 1123 |
+ is_slider=is_slider, |
|
| 1124 |
+ slider_image=slider_image_path, |
|
| 1125 |
+ cover=cover_path, |
|
| 1126 |
+ # image=image_path, |
|
| 1127 |
+ limit_image_num=limit_image_num, |
|
| 1102 | 1128 |
is_signup=is_signup, |
| 1103 | 1129 |
group_share_max_integral=group_share_max_integral, |
| 1104 | 1130 |
group_share_integral=group_share_integral, |
| 1105 |
- is_slider=is_slider, |
|
| 1106 | 1131 |
content_rich_text=content_rich_text, |
| 1107 | 1132 |
share_h5_link=share_h5_link, |
| 1108 | 1133 |
activity_state=activity_state |
@@ -1729,19 +1754,18 @@ def administrator_update(request): |
||
| 1729 | 1754 |
|
| 1730 | 1755 |
if admin_type != -1: |
| 1731 | 1756 |
target_admin.admin_type = admin_type |
| 1732 |
- |
|
| 1757 |
+ |
|
| 1733 | 1758 |
if phone: |
| 1734 | 1759 |
target_admin.phone = phone |
| 1735 |
- |
|
| 1760 |
+ |
|
| 1736 | 1761 |
if name: |
| 1737 | 1762 |
target_admin.name = name |
| 1738 | 1763 |
AdministratorLoginLogInfo.objects.filter(admin_id=target_admin_id).update(admin_name=name) |
| 1739 | 1764 |
|
| 1740 |
- |
|
| 1741 | 1765 |
if password: |
| 1742 | 1766 |
encryption = make_password(strip(password), settings.MAKE_PASSWORD_SALT, settings.MAKE_PASSWORD_HASHER) |
| 1743 | 1767 |
target_admin.encryption = encryption |
| 1744 |
- |
|
| 1768 |
+ |
|
| 1745 | 1769 |
target_admin.save() |
| 1746 | 1770 |
|
| 1747 | 1771 |
return response(200, 'Update Admin Success', u'更新后台管理员成功') |
@@ -1794,8 +1818,9 @@ def administrator_login_list(request): |
||
| 1794 | 1818 |
count = logs.count() |
| 1795 | 1819 |
logs, left = pagination(logs, page, num) |
| 1796 | 1820 |
logs = [log.admindata for log in logs] |
| 1821 |
+ |
|
| 1797 | 1822 |
return response(200, 'Get Administrator Login List Success', u'获取后台管理员登录日志成功', data={
|
| 1798 | 1823 |
'logs': logs, |
| 1799 | 1824 |
'left': left, |
| 1800 | 1825 |
'count': count |
| 1801 |
- }) |
|
| 1826 |
+ }) |
@@ -17,7 +17,7 @@ from TimeConvert import TimeConvert as tc |
||
| 17 | 17 |
from account.models import UserInfo |
| 18 | 18 |
from coupon.models import CouponInfo, UserCouponInfo |
| 19 | 19 |
from integral.models import SaleclerkSubmitLogInfo |
| 20 |
-from logs.models import MchInfoEncryptLogInfo, AdministratorLoginLogInfo |
|
| 20 |
+from logs.models import AdministratorLoginLogInfo, MchInfoEncryptLogInfo |
|
| 21 | 21 |
from mch.models import (ActivityInfo, AdministratorInfo, BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, |
| 22 | 22 |
LatestAppInfo, LatestAppScreenInfo, ModelInfo, OperatorInfo) |
| 23 | 23 |
from statistic.models import ConsumeModelSaleStatisticInfo, ConsumeSaleStatisticInfo, ConsumeUserStatisticInfo |
@@ -79,7 +79,6 @@ def admin_login_api(request): |
||
| 79 | 79 |
if not check_password(password, administrator.encryption): |
| 80 | 80 |
return response(AdministratorStatusCode.ADMINISTRATOR_PASSWORD_ERROR) |
| 81 | 81 |
|
| 82 |
- |
|
| 83 | 82 |
AdministratorLoginLogInfo.objects.create( |
| 84 | 83 |
admin_id=administrator.admin_id, |
| 85 | 84 |
admin_name=administrator.name, |
@@ -69,7 +69,7 @@ class CouponInfo(BaseModelMixin): |
||
| 69 | 69 |
'coupon_valid_period': self.coupon_valid_period, |
| 70 | 70 |
'coupon_expire_at': tc.local_string(utc_dt=self.coupon_expire_at, format='%Y-%m-%d'), |
| 71 | 71 |
'is_coupon_admin_writeoff': self.is_coupon_admin_writeoff, |
| 72 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 72 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
@property |
@@ -186,5 +186,5 @@ class SaleclerkSubmitLogInfo(BaseModelMixin): |
||
| 186 | 186 |
'has_scan': self.has_scan, |
| 187 | 187 |
'image': self.image_url, |
| 188 | 188 |
'code_image': self.code_image_url, |
| 189 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 189 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 190 | 190 |
} |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 |
from django.contrib import admin |
| 4 | 4 |
from django_admin import ReadOnlyModelAdmin |
| 5 | 5 |
|
| 6 |
-from logs.models import (ComplementCodeLogInfo, MchInfoDecryptLogInfo, MchInfoEncryptLogInfo, MchLogInfo, |
|
| 7 |
- MchSearchModelAndCameraLogInfo, AdministratorLoginLogInfo) |
|
| 6 |
+from logs.models import (AdministratorLoginLogInfo, ComplementCodeLogInfo, MchInfoDecryptLogInfo, MchInfoEncryptLogInfo, |
|
| 7 |
+ MchLogInfo, MchSearchModelAndCameraLogInfo) |
|
| 8 | 8 |
|
| 9 | 9 |
|
| 10 | 10 |
class MchInfoEncryptLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin): |
@@ -32,6 +32,7 @@ class ComplementCodeLogInfoAdmin(admin.ModelAdmin): |
||
| 32 | 32 |
list_display = ('user_id', 'log_id', 'name', 'phone', 'model_id', 'model_name', 'sn', 'shot_image', 'invoice_image', 'audit_status', 'ciphertext', 'is_contacted', 'is_upload_qiniu', 'status', 'created_at', 'updated_at')
|
| 33 | 33 |
list_filter = ('model_id', 'audit_status', 'is_contacted', 'is_upload_qiniu', 'status')
|
| 34 | 34 |
|
| 35 |
+ |
|
| 35 | 36 |
class AdministratorLoginLogInfoAdmin(admin.ModelAdmin): |
| 36 | 37 |
list_display = ('admin_id', 'admin_name', 'login_ip', 'login_at', 'status', 'created_at', 'updated_at')
|
| 37 | 38 |
list_filter = ('admin_id', 'admin_name')
|
@@ -53,7 +53,7 @@ class MchInfoEncryptLogInfo(BaseModelMixin): |
||
| 53 | 53 |
'model_uni_name': model.model_uni_name, |
| 54 | 54 |
'model_name': model.model_name, |
| 55 | 55 |
'operator_name': operator_name, |
| 56 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S') |
|
| 56 |
+ 'created_at': tc.local_string(utc_dt=self.created_at) |
|
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 | 59 |
|
@@ -191,21 +191,21 @@ class ComplementCodeLogInfo(BaseModelMixin): |
||
| 191 | 191 |
'audit_status': self.audit_status, |
| 192 | 192 |
'is_contacted': self.is_contacted, |
| 193 | 193 |
'ciphertext': self.ciphertext, |
| 194 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S') |
|
| 194 |
+ 'created_at': tc.local_string(utc_dt=self.created_at) |
|
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 |
+ |
|
| 197 | 198 |
class AdministratorLoginLogInfo(BaseModelMixin): |
| 198 | 199 |
admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'管理员唯一标识') |
| 199 | 200 |
admin_name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'管理员姓名') |
| 200 | 201 |
login_ip = models.CharField(_(u'login_ip'), max_length=32, blank=True, null=True, help_text=_(u'登录IP')) |
| 201 | 202 |
login_at = models.DateTimeField(_(u'login_at'), blank=True, null=True, help_text=_(u'登录时间')) |
| 202 | 203 |
|
| 203 |
- |
|
| 204 | 204 |
@property |
| 205 | 205 |
def admindata(self): |
| 206 | 206 |
return {
|
| 207 | 207 |
'admin_id': self.admin_id, |
| 208 | 208 |
'admin_name': self.admin_name, |
| 209 | 209 |
'login_ip': self.login_ip, |
| 210 |
- 'login_at': tc.local_string(utc_dt=self.login_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 211 |
- } |
|
| 210 |
+ 'login_at': tc.local_string(utc_dt=self.login_at), |
|
| 211 |
+ } |
@@ -795,7 +795,7 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin): |
||
| 795 | 795 |
'phone': self.phone, |
| 796 | 796 |
'code_version': self.code_version, |
| 797 | 797 |
'dupload': self.dupload, |
| 798 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 798 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 799 | 799 |
} |
| 800 | 800 |
|
| 801 | 801 |
|
@@ -76,8 +76,8 @@ class ShotTypeInfoAdmin(DeleteModelAdmin, admin.ModelAdmin): |
||
| 76 | 76 |
|
| 77 | 77 |
|
| 78 | 78 |
class MemberActivityInfoAdmin(admin.ModelAdmin): |
| 79 |
- list_display = ('activity_id', 'title', 'subtitle', 'date', 'city', 'location', 'lat', 'lon', 'image', 'cover', 'is_slider', 'slider_image', 'share_img_link', 'share_h5_link', 'is_signup', 'activity_state', 'position', 'is_upload_qiniu', 'status', 'created_at', 'updated_at')
|
|
| 80 |
- list_filter = ('is_slider', 'is_signup', 'activity_state', 'is_upload_qiniu', 'status')
|
|
| 79 |
+ list_display = ('activity_id', 'activity_type', 'title', 'subtitle', 'date', 'start_date', 'end_date', 'start_display_date', 'end_display_date', 'city', 'location', 'lat', 'lon', 'is_slider', 'slider_image', 'cover', 'limit_image_num', 'share_img_link', 'share_h5_link', 'is_signup', 'activity_state', 'position', 'is_upload_qiniu', 'status', 'created_at', 'updated_at')
|
|
| 80 |
+ list_filter = ('activity_type', 'is_slider', 'is_signup', 'activity_state', 'is_upload_qiniu', 'status')
|
|
| 81 | 81 |
|
| 82 | 82 |
|
| 83 | 83 |
class MemberActivitySignupInfoAdmin(admin.ModelAdmin): |
@@ -0,0 +1,39 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 3.2.16 on 2022-10-21 14:12 |
|
| 3 |
+ |
|
| 4 |
+from django.db import migrations, models |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+class Migration(migrations.Migration): |
|
| 8 |
+ |
|
| 9 |
+ dependencies = [ |
|
| 10 |
+ ('member', '0032_auto_20220704_2001'),
|
|
| 11 |
+ ] |
|
| 12 |
+ |
|
| 13 |
+ operations = [ |
|
| 14 |
+ migrations.AddField( |
|
| 15 |
+ model_name='memberactivityinfo', |
|
| 16 |
+ name='activity_type', |
|
| 17 |
+ field=models.IntegerField(choices=[(0, '线下活动'), (1, '公众号文章'), (2, '线上活动'), (3, '投稿活动')], db_index=True, default=0, help_text='活动类型', verbose_name='activity_type'), |
|
| 18 |
+ ), |
|
| 19 |
+ migrations.AddField( |
|
| 20 |
+ model_name='memberactivityinfo', |
|
| 21 |
+ name='end_date', |
|
| 22 |
+ field=models.DateField(blank=True, help_text='活动报名截止日期', null=True, verbose_name='end_date'), |
|
| 23 |
+ ), |
|
| 24 |
+ migrations.AddField( |
|
| 25 |
+ model_name='memberactivityinfo', |
|
| 26 |
+ name='end_display_date', |
|
| 27 |
+ field=models.DateField(blank=True, help_text='活动展示截止日期', null=True, verbose_name='end_display_date'), |
|
| 28 |
+ ), |
|
| 29 |
+ migrations.AddField( |
|
| 30 |
+ model_name='memberactivityinfo', |
|
| 31 |
+ name='start_date', |
|
| 32 |
+ field=models.DateField(blank=True, help_text='活动报名开始日期', null=True, verbose_name='start_date'), |
|
| 33 |
+ ), |
|
| 34 |
+ migrations.AddField( |
|
| 35 |
+ model_name='memberactivityinfo', |
|
| 36 |
+ name='start_display_date', |
|
| 37 |
+ field=models.DateField(blank=True, help_text='活动展示开始日期', null=True, verbose_name='start_display_date'), |
|
| 38 |
+ ), |
|
| 39 |
+ ] |
@@ -0,0 +1,19 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 3.2.16 on 2022-10-23 05:28 |
|
| 3 |
+ |
|
| 4 |
+from django.db import migrations, models |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+class Migration(migrations.Migration): |
|
| 8 |
+ |
|
| 9 |
+ dependencies = [ |
|
| 10 |
+ ('member', '0033_auto_20221021_2212'),
|
|
| 11 |
+ ] |
|
| 12 |
+ |
|
| 13 |
+ operations = [ |
|
| 14 |
+ migrations.AddField( |
|
| 15 |
+ model_name='memberactivityinfo', |
|
| 16 |
+ name='limit_image_num', |
|
| 17 |
+ field=models.IntegerField(default=3, help_text='限制图片数量', verbose_name='limit_image_num'), |
|
| 18 |
+ ), |
|
| 19 |
+ ] |
@@ -124,7 +124,7 @@ class GoodsInfo(BaseModelMixin): |
||
| 124 | 124 |
'value': self.value, |
| 125 | 125 |
'left_num': self.left_num, |
| 126 | 126 |
'coupon': coupon, |
| 127 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 127 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 128 | 128 |
} |
| 129 | 129 |
|
| 130 | 130 |
@property |
@@ -147,7 +147,7 @@ class GoodsInfo(BaseModelMixin): |
||
| 147 | 147 |
'desc': self.desc, |
| 148 | 148 |
'left_num': self.left_num, |
| 149 | 149 |
'coupon': coupon, |
| 150 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 150 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 151 | 151 |
} |
| 152 | 152 |
|
| 153 | 153 |
|
@@ -207,7 +207,7 @@ class GoodsOrderInfo(BaseModelMixin): |
||
| 207 | 207 |
'user_address': self.address, |
| 208 | 208 |
'tracking_number': self.tracking_number, |
| 209 | 209 |
'integral': self.integral, |
| 210 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 210 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 211 | 211 |
'send_template_message_res': json.loads(self.send_template_message_res) if self.send_template_message_res else '', |
| 212 | 212 |
'remark': self.remark |
| 213 | 213 |
} |
@@ -342,20 +342,35 @@ class ShotTypeInfo(BaseModelMixin): |
||
| 342 | 342 |
|
| 343 | 343 |
|
| 344 | 344 |
class MemberActivityInfo(BaseModelMixin): |
| 345 |
+ ACTIVITY_TYPE = ( |
|
| 346 |
+ (0, u'线下活动'), |
|
| 347 |
+ (1, u'公众号文章'), |
|
| 348 |
+ (2, u'线上活动'), |
|
| 349 |
+ (3, u'投稿活动'), |
|
| 350 |
+ ) |
|
| 351 |
+ |
|
| 345 | 352 |
ACTIVITY_STATE = ( |
| 346 | 353 |
(0, u'草稿'), |
| 347 | 354 |
(1, u'已发布'), |
| 348 | 355 |
(2, u'下线'), |
| 349 | 356 |
) |
| 357 |
+ |
|
| 350 | 358 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, default='', help_text=u'品牌唯一标识', db_index=True) |
| 351 | 359 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, default='', help_text=u'品牌名称') |
| 352 | 360 |
|
| 353 | 361 |
activity_id = ShortUUIDField(_(u'activity_id'), max_length=32, blank=True, help_text=u'活动唯一标识', db_index=True, unique=True) |
| 354 | 362 |
|
| 363 |
+ activity_type = models.IntegerField(_(u'activity_type'), choices=ACTIVITY_TYPE, default=0, help_text=u'活动类型', db_index=True) |
|
| 364 |
+ |
|
| 355 | 365 |
title = models.CharField(_(u'title'), max_length=255, blank=True, default='', help_text=u'活动名称') |
| 356 | 366 |
subtitle = models.CharField(_(u'subtitle'), max_length=255, blank=True, default='', help_text=u'活动二级名称') |
| 357 | 367 |
|
| 358 | 368 |
date = models.DateField(_(u'date'), blank=True, null=True, help_text=u'活动时间') |
| 369 |
+ start_date = models.DateField(_(u'start_date'), blank=True, null=True, help_text=u'活动报名开始日期') |
|
| 370 |
+ end_date = models.DateField(_(u'end_date'), blank=True, null=True, help_text=u'活动报名截止日期') |
|
| 371 |
+ start_display_date = models.DateField(_(u'start_display_date'), blank=True, null=True, help_text=u'活动展示开始日期') |
|
| 372 |
+ end_display_date = models.DateField(_(u'end_display_date'), blank=True, null=True, help_text=u'活动展示截止日期') |
|
| 373 |
+ |
|
| 359 | 374 |
city = models.CharField(_(u'city'), max_length=255, blank=True, default='', help_text=u'活动城市') |
| 360 | 375 |
location = models.CharField(_(u'location'), max_length=255, blank=True, default='', help_text=u'活动地点') |
| 361 | 376 |
lat = models.FloatField(_(u'lat'), default=1.0, help_text=u'纬度') |
@@ -365,12 +380,11 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 365 | 380 |
group_share_integral = models.IntegerField(_(u'group_share_integral'), default=0, help_text=u'群组分享会员积分') |
| 366 | 381 |
group_share_max_integral = models.IntegerField(_(u'group_share_max_integral'), default=0, help_text=u'群组分享会员积分单人上限') |
| 367 | 382 |
|
| 368 |
- image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, help_text=u'活动内容图片') |
|
| 369 |
- |
|
| 370 |
- cover = models.ImageField(_(u'cover'), upload_to=upload_path, blank=True, help_text=u'活动列表图片') |
|
| 371 |
- |
|
| 372 | 383 |
is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=u'是否为轮播活动') |
| 373 | 384 |
slider_image = models.ImageField(_(u'slider_image'), upload_to=upload_path, blank=True, help_text=u'活动轮播图片') |
| 385 |
+ cover = models.ImageField(_(u'cover'), upload_to=upload_path, blank=True, help_text=u'活动列表图片') |
|
| 386 |
+ limit_image_num = models.IntegerField(_(u'limit_image_num'), default=3, help_text=u'限制图片数量') |
|
| 387 |
+ image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, help_text=u'活动内容图片') |
|
| 374 | 388 |
|
| 375 | 389 |
content_rich_text = RichTextField(_(u'content_rich_text'), blank=True, default='', help_text=u'活动描述') |
| 376 | 390 |
|
@@ -393,12 +407,12 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 393 | 407 |
return '%d' % self.pk |
| 394 | 408 |
|
| 395 | 409 |
@property |
| 396 |
- def image_path(self): |
|
| 397 |
- return upload_file_path(self.image) |
|
| 410 |
+ def slider_image_path(self): |
|
| 411 |
+ return upload_file_path(self.slider_image) |
|
| 398 | 412 |
|
| 399 | 413 |
@property |
| 400 |
- def image_url(self): |
|
| 401 |
- return qiniu_file_url(self.image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.image) |
|
| 414 |
+ def slider_image_url(self): |
|
| 415 |
+ return qiniu_file_url(self.slider_image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.slider_image) |
|
| 402 | 416 |
|
| 403 | 417 |
@property |
| 404 | 418 |
def cover_path(self): |
@@ -408,13 +422,13 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 408 | 422 |
def cover_url(self): |
| 409 | 423 |
return qiniu_file_url(self.cover.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.cover) |
| 410 | 424 |
|
| 411 |
- @property |
|
| 412 |
- def slider_image_path(self): |
|
| 413 |
- return upload_file_path(self.slider_image) |
|
| 414 |
- |
|
| 415 |
- @property |
|
| 416 |
- def slider_image_url(self): |
|
| 417 |
- return qiniu_file_url(self.slider_image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.slider_image) |
|
| 425 |
+ # @property |
|
| 426 |
+ # def image_path(self): |
|
| 427 |
+ # return upload_file_path(self.image) |
|
| 428 |
+ # |
|
| 429 |
+ # @property |
|
| 430 |
+ # def image_url(self): |
|
| 431 |
+ # return qiniu_file_url(self.image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.image) |
|
| 418 | 432 |
|
| 419 | 433 |
@property |
| 420 | 434 |
def final_state(self): |
@@ -435,18 +449,25 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 435 | 449 |
return {
|
| 436 | 450 |
'id': self.activity_id, |
| 437 | 451 |
'activity_id': self.activity_id, |
| 452 |
+ 'activity_type': self.activity_type, |
|
| 453 |
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type), |
|
| 438 | 454 |
'title': self.title, |
| 439 | 455 |
'subtitle': self.subtitle, |
| 440 |
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
| 456 |
+ 'date': tc.local_date_string(self.date), |
|
| 457 |
+ 'start_date': tc.local_date_string(self.start_date), |
|
| 458 |
+ 'end_date': tc.local_date_string(self.end_date), |
|
| 459 |
+ 'start_display_date': tc.local_date_string(self.start_display_date), |
|
| 460 |
+ 'end_display_date': tc.local_date_string(self.end_display_date), |
|
| 441 | 461 |
'city': self.city, |
| 442 | 462 |
'location': self.location, |
| 443 | 463 |
'lat': self.lat, |
| 444 | 464 |
'lon': self.lon, |
| 445 | 465 |
'integral': self.integral, |
| 466 |
+ 'slider_image': self.slider_image_url, |
|
| 446 | 467 |
'cover_url': self.cover_url, |
| 468 |
+ 'limit_image_num': self.limit_image_num, |
|
| 447 | 469 |
'share_img_link': self.share_img_link, |
| 448 | 470 |
'share_h5_link': self.share_h5_link, |
| 449 |
- 'slider_image': self.slider_image_url, |
|
| 450 | 471 |
'state': self.final_state, |
| 451 | 472 |
'is_signed': self.is_signed(user_id), |
| 452 | 473 |
'is_signup': self.is_signup, |
@@ -456,19 +477,26 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 456 | 477 |
return {
|
| 457 | 478 |
'id': self.activity_id, |
| 458 | 479 |
'activity_id': self.activity_id, |
| 480 |
+ 'activity_type': self.activity_type, |
|
| 481 |
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type), |
|
| 459 | 482 |
'title': self.title, |
| 460 | 483 |
'subtitle': self.subtitle, |
| 461 |
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
| 484 |
+ 'date': tc.local_date_string(self.date), |
|
| 485 |
+ 'start_date': tc.local_date_string(self.start_date), |
|
| 486 |
+ 'end_date': tc.local_date_string(self.end_date), |
|
| 487 |
+ 'start_display_date': tc.local_date_string(self.start_display_date), |
|
| 488 |
+ 'end_display_date': tc.local_date_string(self.end_display_date), |
|
| 462 | 489 |
'city': self.city, |
| 463 | 490 |
'location': self.location, |
| 464 | 491 |
'lat': self.lat, |
| 465 | 492 |
'lon': self.lon, |
| 466 | 493 |
'integral': self.integral, |
| 467 |
- 'content_rich_text': self.content_rich_text, |
|
| 494 |
+ 'slider_image': self.slider_image_url, |
|
| 468 | 495 |
'cover_url': self.cover_url, |
| 496 |
+ 'limit_image_num': self.limit_image_num, |
|
| 497 |
+ 'content_rich_text': self.content_rich_text, |
|
| 469 | 498 |
'share_img_link': self.share_img_link, |
| 470 | 499 |
'share_h5_link': self.share_h5_link, |
| 471 |
- 'slider_image': self.slider_image_url, |
|
| 472 | 500 |
'state': self.final_state, |
| 473 | 501 |
'is_signed': self.is_signed(user_id), |
| 474 | 502 |
'is_signup': self.is_signup, |
@@ -479,25 +507,32 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 479 | 507 |
return {
|
| 480 | 508 |
'id': self.activity_id, |
| 481 | 509 |
'activity_id': self.activity_id, |
| 510 |
+ 'activity_type': self.activity_type, |
|
| 511 |
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type), |
|
| 482 | 512 |
'title': self.title, |
| 483 | 513 |
'subtitle': self.subtitle, |
| 484 |
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
| 514 |
+ 'date': tc.local_date_string(self.date), |
|
| 515 |
+ 'start_date': tc.local_date_string(self.start_date), |
|
| 516 |
+ 'end_date': tc.local_date_string(self.end_date), |
|
| 517 |
+ 'start_display_date': tc.local_date_string(self.start_display_date), |
|
| 518 |
+ 'end_display_date': tc.local_date_string(self.end_display_date), |
|
| 485 | 519 |
'city': self.city, |
| 486 | 520 |
'location': self.location, |
| 487 | 521 |
'lat': self.lat, |
| 488 | 522 |
'lon': self.lon, |
| 489 | 523 |
'integral': self.integral, |
| 524 |
+ 'is_slider': self.is_slider, |
|
| 525 |
+ 'slider_image': self.slider_image_url, |
|
| 490 | 526 |
'cover_url': self.cover_url, |
| 527 |
+ 'limit_image_num': self.limit_image_num, |
|
| 491 | 528 |
'share_img_link': self.share_img_link, |
| 492 | 529 |
'share_h5_link': self.share_h5_link, |
| 493 |
- 'slider_image': self.slider_image_url, |
|
| 494 | 530 |
'state': self.final_state, |
| 495 | 531 |
'is_signup': self.is_signup, |
| 496 | 532 |
'share_integral': self.group_share_integral, |
| 497 | 533 |
'share_max_integral': self.group_share_max_integral, |
| 498 |
- 'is_slider': self.is_slider, |
|
| 499 | 534 |
'activity_state': self.activity_state, |
| 500 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 535 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 501 | 536 |
} |
| 502 | 537 |
|
| 503 | 538 |
@property |
@@ -505,28 +540,35 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 505 | 540 |
return {
|
| 506 | 541 |
'id': self.activity_id, |
| 507 | 542 |
'activity_id': self.activity_id, |
| 543 |
+ 'activity_type': self.activity_type, |
|
| 544 |
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type), |
|
| 508 | 545 |
'title': self.title, |
| 509 | 546 |
'subtitle': self.subtitle, |
| 510 |
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
| 547 |
+ 'date': tc.local_date_string(self.date), |
|
| 548 |
+ 'start_date': tc.local_date_string(self.start_date), |
|
| 549 |
+ 'end_date': tc.local_date_string(self.end_date), |
|
| 550 |
+ 'start_display_date': tc.local_date_string(self.start_display_date), |
|
| 551 |
+ 'end_display_date': tc.local_date_string(self.end_display_date), |
|
| 511 | 552 |
'city': self.city, |
| 512 | 553 |
'location': self.location, |
| 513 | 554 |
'lat': self.lat, |
| 514 | 555 |
'lon': self.lon, |
| 515 | 556 |
'integral': self.integral, |
| 516 |
- 'content_rich_text': self.content_rich_text, |
|
| 557 |
+ 'is_slider': self.is_slider, |
|
| 558 |
+ 'banner_path': self.slider_image_path, |
|
| 559 |
+ 'slider_image': self.slider_image_url, |
|
| 560 |
+ 'cover_path': self.cover_path, |
|
| 517 | 561 |
'cover_url': self.cover_url, |
| 562 |
+ 'limit_image_num': self.limit_image_num, |
|
| 563 |
+ 'content_rich_text': self.content_rich_text, |
|
| 518 | 564 |
'share_img_link': self.share_img_link, |
| 519 | 565 |
'share_h5_link': self.share_h5_link, |
| 520 |
- 'slider_image': self.slider_image_url, |
|
| 521 | 566 |
'state': self.final_state, |
| 522 | 567 |
'is_signup': self.is_signup, |
| 523 | 568 |
'share_integral': self.group_share_integral, |
| 524 | 569 |
'share_max_integral': self.group_share_max_integral, |
| 525 | 570 |
'activity_state': self.activity_state, |
| 526 |
- 'is_slider': self.is_slider, |
|
| 527 |
- 'banner_path': self.slider_image_path, |
|
| 528 |
- 'cover_path': self.cover_path, |
|
| 529 |
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
|
| 571 |
+ 'created_at': tc.local_string(utc_dt=self.created_at), |
|
| 530 | 572 |
} |
| 531 | 573 |
|
| 532 | 574 |
|
@@ -1,7 +1,7 @@ |
||
| 1 | 1 |
CodeConvert==3.0.2 |
| 2 | 2 |
Pillow==9.2.0 |
| 3 | 3 |
StatusCode==1.0.0 |
| 4 |
-TimeConvert==2.0.3 |
|
| 4 |
+TimeConvert==2.0.4 |
|
| 5 | 5 |
furl==2.1.3 |
| 6 | 6 |
isoweek==1.3.3 |
| 7 | 7 |
jsonfield==3.1.0 |
@@ -1,4 +1,4 @@ |
||
| 1 |
-Django==3.2.14 |
|
| 1 |
+Django==3.2.16 |
|
| 2 | 2 |
django-admin==2.0.1 |
| 3 | 3 |
django-cors-headers==3.10.0 |
| 4 | 4 |
django-curtail-uuid==1.0.4 |